<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = 'sixnumber31';	//語言檔參數，務必放在最前面
$intSid = $_data["sid"];

$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 1;

include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/todaygame/Gamble". $intLID .".inc.php");
include_once(__Common_Path."/gambletype/GambleType".$_SESSION[Member_Info] -> GambleType."_".$intLID.".inc.php");

//取得 TodayGame 資料
$intBT = 31;
$arrColorSet = explode(",", $_arrLotto[$intLID]["ColorSet"]);
$arrColor = array("red", "blue", "green");
include_once(__Common_Path."/todaygame/TodayGame". $intLID ."_31.inc.php");

$isStop = false;
if (!is_array($_arrTodayGame) || !is_array($_arrGamble)) {
	$isStop = true;
} else {
	list($intGID, $arrGData) = each($_arrGamble);

	//判斷是否有 Game 時間是否過期
	$GameEndDateTime	= $arrGData["GameDate"] .' '. $arrGData["EndGameTime"];
	$NowDateTime		= date("Y-m-d") .' '. date("H:i:s");

	if ($NowDateTime > $GameEndDateTime) {
		$isStop = true;
	} else {
		$isStop = false;
	}
	$arrTGame = $_arrTodayGame[$intGID][31];
}


$fp = @file(__Membertemplate_Path."/sixnumber31.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$fp = str_replace("{SerialNo}", ($isStop)?"0":$arrGData["SerialNo"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGData["GameDate"], $fp);
$fp = str_replace("{ShowGameTime}", $arrGData["GameTime"], $fp);
$fp = str_replace("{LottoID}", $intLID, $fp);
$fp = str_replace("{GambleID}", $intGID, $fp);
$fp = str_replace("{sid}", $intSid, $fp);

$strCloseClass = "class='rt_mt_con_odds_grey'";
$isWagerStop = true;

$strCon = "";
for($j = 1; $j <= 10; $j++){
	$strCon .= "<tr class='mcen'>";
	for($i = 0; $i < 5; $i++){
		$intNum = $i*10 + $j;
		if($intNum == 50){
			$strCon .= "<td colspan='3' class='mbline'>\n";
			$strCon .= "<input name='BSubmit' type='submit' class='zabottonR' value='{BSubmit}' disabled>\n";
			$strCon .= "<input type='reset' class='zabotton' value='{BReset}'>\n";
			$strCon .= "</td>\n";
			continue;
		}

		$intApointNum = $_arrGLineNumToApointNum[$intLID][$intBT][$intNum];
		if($intApointNum == null)$intApointNum = 0;
		$intOddsID = $arrTGame[$intNum][OddsID];
		$flOdds = $arrTGame[$intNum][Odds] + $_arrGambleType[$intBT][$intApointNum];

		$strCon .= "<th style='color:".$arrColor[$arrColorSet[$intNum - 1]]."'>".sprintf("%02s", $intNum)."</th>\n";

		if($arrTGame[$intNum][isStopBet]){
			$strCon .= "<td class='mbline_ratio'>&nbsp;</td>\n";
			$strCon .= "<td class='mbline' id='NumOdds".$intNum."' ".$strCloseClass." onclick='CheckChoice()'><input type='checkbox' name='ChoiceNumber[31][".$intNum."]' value='' disabled></td>\n";

		}else{
			$strCon .= "<td class='mbline_ratio'>".$flOdds."</td>\n";
			$isWagerStop = false;
			$strCon .= "<td class='mbline' id='NumOdds".$intNum."' onmouseover='ChangeClass(".$intNum.", 31, 1)' onmouseout='ChangeClass(".$intNum.", 31, 0)' onclick='CheckChoice()'><input type='checkbox' name='ChoiceNumber[31][".$intNum."]' value='".$intOddsID."#".$flOdds."'></td>\n";
		}
	}
	$strCon .= "</tr>";
}

$fp = preg_replace("/<!-- bof: OddsContent \/\/-->.+<!-- eof: OddsContent \/\/-->/s", $strCon, $fp);

//以下位置不可上下移動
while(list($k, $v) = each($_strSixNumber31)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>